package cn.laixueit.resource.feign.controller;

import cn.laixueit.resource.feign.client.DataDictFeign;
import cn.laixueit.resource.feign.result.R;
import cn.laixueit.source.api.DataDictInterface;
import cn.laixueit.source.po.TbDataDict;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author duxiang
 * @date 2024/3/8 15:22
 */
@RestController
@Slf4j
public class DataDictController implements DataDictInterface {
    @Resource
    private DataDictFeign dataDictFeign;

    @Override
    public R save(TbDataDict dataDict) {
        return R.data(dataDictFeign.save(dataDict)) ;
    }

    @Override
    public R update(TbDataDict dataDict) {
        return R.data(dataDictFeign.update(dataDict));
    }

    @Override
    public R remove(TbDataDict dataDict) {
        return R.data(dataDictFeign.remove(dataDict));
    }

    @Override
    public R get(TbDataDict dataDict) {
        return R.data(dataDictFeign.get(dataDict));
    }

    @Override
    public R list(TbDataDict dataDict) {
        return R.data(dataDictFeign.list(dataDict));
    }

    @Override
    public R page(Integer page, Integer size, TbDataDict dataDict) {
        return R.data(dataDictFeign.page(page, size, dataDict));
    }

    @PostMapping("/datadictdetail/findDataDictAndDetail")
    public R findDataDetail(@RequestBody List<String> codes){
        return  R.data(dataDictFeign.findDataDetail(codes));
    }
}
